package com.peanut.baby.util;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.peanut.baby.model.UploadConf;
import com.tencent.mars.xlog.Log;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by anonymouslystudio on 2017/7/21.
 */

public class JsonParser {
    private static final String TAG = JsonParser.class.getSimpleName();

    public static List<UploadConf> getConfigs(String str){
        Gson gson = new Gson();
        List<UploadConf> rs = new ArrayList<>();

        Type type = new TypeToken<ArrayList<UploadConf>>() {}.getType();

        rs=gson.fromJson(str, type);

        for(UploadConf o:rs){
            Log.d(TAG,"uploadConf:"+o.toString());

        }
        return rs;
    }
}
